﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Community.CsharpSqlite.Entity
{

    /*
** The following type and function are used to iterate through all opcodes
** in a Vdbe main program and each of the sub-programs (triggers) it may 
** invoke directly or indirectly. It should be used as follows:
**
**   Op *pOp;
**   VdbeOpIter sIter;
**
**   memset(&sIter, 0, sizeof(sIter));
**   sIter.v = v;                            // v is of type Vdbe* 
**   while( (pOp = opIterNext(&sIter)) ){
**     // Do something with pOp
**   }
**   MemPool.DbFree(v->db, sIter.apSub);
** 
*/
    //typedef struct VdbeOpIter VdbeOpIter;
    public class VdbeOpIter
    {
        public SubProgram[] apSub; /* Array of subprograms */
        public int iAddr; /* Address of next instruction to return */
        public int iSub; /* 0 = main program, 1 = first sub-program etc. */
        public int nSub; /* Number of entries in apSub */
        public Vdbe v; /* Vdbe to iterate through the opcodes of */
    };
}
